﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditLoaiDon.ascx.cs" Inherits="CMS.Web.ListManager.EditLoaiDon" %>
<table width="100%" align="center" style="border-collapse: collapse" cellSpacing="0" cellPadding="0" border="0">
    <tr><td valign="middle" align="center" height="50px"><font class="Title">HIỆU CHỈNH LOẠI ĐƠN</font></td>
    </tr>
    <tr>
        <td width="100%">
			<table id="tblNew" class="Table_Border" style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0" width="99%" align="center" border="0">
			    <tr class="">
				    <td colSpan="2">
					    <table width="100%" border="0">
					        <tr class="">
							    <td width="40%" height="20px"><asp:label id="lblEdit" Runat="server"></asp:label></TD>
								<td align="right" width="60%"><asp:label id="lblMsg" Runat="server" ForeColor="#FF0000" Font-Names="Verdana"></asp:label></TD>
							</tr>
						</table>
					</td>
		        </tr>
                <tr>
		            <td class="Col_Left" width="23%">Tên loại đơn <font color="#ff0000">(*)</font>:</td>
			        <td class="Col_Right">
                        <asp:textbox id="txtName" runat="server" CssClass="TextBox" Width="76%" MaxLength="50"></asp:textbox>
                    </td>
                </tr>
                <tr>
		            <td class="Col_Left" width="23%" valign="top">Mô tả:</TD>
			        <td class="Col_Right">
                        <asp:textbox id="txtMoTa" runat="server" CssClass="TextArea" Width="76%" MaxLength="100" Height="139px" TextMode="MultiLine" Rows="5"></asp:textbox>
                    </td>
                </tr>
                <tr>
		            <td class="Col_Left" width="23%">Thứ tự hiển thị:</TD>
			        <td class="Col_Right">
                        <asp:textbox id="txtSTT" runat="server" CssClass="TextBox" Width="76%" MaxLength="5"></asp:textbox>
                    </td>
                </tr>
				<tr>
				    <td class="Col_Left">Trạng thái:</td>
					<td class="Col_Right">
                        <asp:radiobuttonlist id="radStatus" Runat="server" CssClass="Col_Right" RepeatDirection="Horizontal" RepeatColumns="2" width="50%">
						    <asp:ListItem Selected="True" Value="true">Sử dụng</asp:ListItem>
						    <asp:ListItem Value="false">Không sử dụng</asp:ListItem>
					    </asp:radiobuttonlist>
                    </td>
                </tr>
				<tr>
                    <td></td>
				    <td height="30" class="Col_Right">
				        <input type="button" class="Button" onclick="CheckInput(0);" value="Cập nhật" />
                        <asp:button style="display:none" id="btnOK" runat="server" CssClass="Button" Text="Cập nhật" OnClick="btnOK_Click"></asp:button>
						<asp:button id="btnCancel" Runat="server" CssClass="Button" Text="Bỏ qua" CausesValidation="False" OnClick="btnCancel_Click"></asp:button>
                        <input type="hidden" id="hidID" name="hidID" runat="server" />
                    </td>
				</tr>
	        </table>
		</td>
    </tr>
</table>
<script language="javascript" src="Common/util.js"></script>
<script language="javascript">
    function CheckInput_callback(res){
        strMsg = "";
        strMsg += isValid("<%=txtName.ClientID %>",50,1,spec,1,0,"Tên loại đơn");
        strMsg += isValid("<%=txtSTT.ClientID %>",2,-1,number,0,0,"Thứ tự hiển thị");
        strMsg += isValid("<%=txtMoTa.ClientID %>",100,-1,spec,1,0,"Mô tả");
        if (res.value && $("#<%=txtName.ClientID %>").val() != ""){
            strMsg += "\n - Tên loại đơn này đã được đặt!";
        }
        
        if (strMsg!=""){
            strMsg = strMsg.substr(1);
            alert(strMsg);
            window.returnValue = false;
            return false;
        }
        else{
            //$('<%=btnOK.ClientID %>').click();
            document.getElementById('<%=btnOK.ClientID %>').click();
        }
    }
    function CheckInput(cont){
        CMS.Presenters.Presenters.ListManager.EditLoaiDonPresenter.isSameName($("#<%=txtName.ClientID %>").val(), $("#<%=hidID.ClientID %>").val(), CheckInput_callback);
    }
</script>